<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css"></style>
</head>
<body>
    <h1>cookie</h1>
    <hr>

    <script>
    document.write('cookie: ' + document.cookie + '<br>');

    document.cookie = 'sex=女';
    document.write('cookie: ' + document.cookie + '<br>');

    document.cookie = 'username=静静; path=/';
    document.write('cookie: ' + document.cookie + '<br>');

    var d = new Date();
    d.setTime(d.getTime()+3600*1000);
    document.cookie = 'username=静静; path=/;   expires=' + d.toUTCString();
  
    </script>
</body>
</html>